﻿using Eleven.Wcf.Service;
using Eleven.Wcf.ServiceInterface;
using System;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace Eleven.Wcf.Hosting
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var host = new ServiceHost(typeof(TestService)))
            {
                //host.AddServiceEndpoint(typeof(ITestService), new WSHttpBinding(), "http://localhost:3721/wcfservice");

                //if (host.Description.Behaviors.Find<ServiceMetadataBehavior>() == null)
                //{
                //    var behavior = new ServiceMetadataBehavior();
                //    behavior.HttpGetEnabled = true;
                //    behavior.HttpGetUrl = new Uri("http://localhost:3721/wcfservice/metadata");
                //    host.Description.Behaviors.Add(behavior);
                //}

                host.Opened += delegate
                {
                    Console.WriteLine("WCF service is opened; press any key to terminate.");
                };

                host.Open();
                Console.ReadKey();
            }
        }
    }
}
